/**
 * Copyright 2013 Viettel Telecom. All rights reserved.
 * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.viettel.core.entities.cms;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Index;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;

import com.viettel.core.enumtype.MultiMediaItemObjectType;
import com.viettel.core.enumtype.MultiMediaItemStatus;
import com.viettel.core.enumtype.MultiMediaItemType;

/**
 *  TABLE MULTI MEDIA
 *  @author: ToanTM1
 *  @version: 2.1
 *  @since: 28-02-2014 - 10:38:22
 */
@Entity
@Table(name = "MULTI_MEDIA_ITEM")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@SequenceGenerator(name = "SEQ_STORE", sequenceName = "ARTICLE_SEQ", allocationSize = 1)
public class MultiMediaItem  implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 2536895560348137181L;

	/**
	 * ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STORE")
	@Column(name = "ID")
//	@Index(name="ARTICLE_ID_PK")
	private Integer id;
	
	/**
	 * ID THEO LOAI
	 */
	@Basic
	@Column(name = "OBJECT_ID", columnDefinition = "NUMBER(10,0)", nullable = false)
	private Integer objectId;
	
	/**
	 * LOAI TABLE
	 */
	@Basic
	@Column(name = "OBJECT_TYPE", columnDefinition = "NUMBER(1,0)", nullable = false)
	@Type(type = "com.viettel.core.enumtype.GenericEnumUserType", parameters = {
			@Parameter(name = "enumClass", value = "com.viettel.core.enumtype.MultiMediaItemObjectType"),
			@Parameter(name = "identifierMethod", value = "getValue"),
			@Parameter(name = "valueOfMethod", value = "parseValue") })
	@Index(name="MULTI_MEDIA_ITEM_OBJECTTYPEX")
	private MultiMediaItemObjectType objectType;
	
	/**
	 * TRANG THAI
	 */
	@Basic
	@Column(name = "STATUS", columnDefinition = "NUMBER(1,0)", nullable = false)
	@Type(type = "com.viettel.core.enumtype.GenericEnumUserType", parameters = {
			@Parameter(name = "enumClass", value = "com.viettel.core.enumtype.MultiMediaItemStatus"),
			@Parameter(name = "identifierMethod", value = "getValue"),
			@Parameter(name = "valueOfMethod", value = "parseValue") })
	@Index(name="MULTI_MEDIA_ITEM_STATUSX")
	private MultiMediaItemStatus status;
	
	/**
	 * LOAI HINH ANH/AUDIO/VIDEO
	 */
	@Basic
	@Column(name = "TYPE", columnDefinition = "NUMBER(1,0)", nullable = false)
	@Type(type = "com.viettel.core.enumtype.GenericEnumUserType", parameters = {
			@Parameter(name = "enumClass", value = "com.viettel.core.enumtype.MultiMediaItemType"),
			@Parameter(name = "identifierMethod", value = "getValue"),
			@Parameter(name = "valueOfMethod", value = "parseValue") })
	@Index(name="MULTI_MEDIA_ITEM_TYPEX")
	private MultiMediaItemType type;
	
	/**
	 * LINK
	 */
	@Basic
	@Column(name = "URL", length = 500)
	private String url;
	
	/**
	 * CHIEU CAO
	 */
	@Basic
	@Column(name = "HEIGHT")
	private Integer height;
	
	/**
	 * CHIEU RONG
	 */
	@Basic
	@Column(name = "WIDTH")
	private Integer width;
	
	@Basic
	@Column(name = "CREATED_TIME", columnDefinition = "timestamp(9) default systimestamp", insertable = false, updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date createdTime;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getObjectId() {
		return objectId;
	}

	public void setObjectId(Integer objectId) {
		this.objectId = objectId;
	}

	public MultiMediaItemObjectType getObjectType() {
		return objectType;
	}

	public void setObjectType(MultiMediaItemObjectType objectType) {
		this.objectType = objectType;
	}

	public MultiMediaItemType getType() {
		return type;
	}

	public void setType(MultiMediaItemType type) {
		this.type = type;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Integer getHeight() {
		return height;
	}

	public void setHeight(Integer height) {
		this.height = height;
	}

	public Integer getWidth() {
		return width;
	}

	public void setWidth(Integer width) {
		this.width = width;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	/**
	 * @return the status
	 */
	public MultiMediaItemStatus getStatus() {
		return status;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(MultiMediaItemStatus status) {
		this.status = status;
	}
}
